package y24.m3;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Test8 {
    static class Solution {
        public double findMedianSortedArrays(int[] nums1, int[] nums2) {
            int l1 = nums1.length;
            System.out.println(l1);
            int l2 = nums2.length;
            System.out.println(l2);
            double[] num = new double[l1 + l2];
            for (int i = 0; i < l1; i++) {
                num[i] = nums1[i];
            }
            for (int i = 0,j = l1; i < l2; i++,j++) {
                num[j] = nums2[i];
            }
            Arrays.sort(num);
            int l = l1 + l2;
            System.out.println(l);
            if (l % 2 == 0){
                System.out.println(l/2);
                return (num[l/2] + num[l/2+1])/2;
            }else {
                return num[l/2];
            }
        }
    }

    public static void main(String[] args) {
        Solution solution = new Solution();
        int[] nums1 = {1,2};
        int[] nums2 = {3};
        System.out.println(solution.findMedianSortedArrays(nums1,nums2));
    }
}